package com.xuecheng.content.api.controller;

import com.xuecheng.content.model.dto.CoursePreviewDto;
import com.xuecheng.content.services.service.CourseBaseInfoService;
import com.xuecheng.content.services.service.CoursePublishService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:王亚栋
 * @Date:2023/8/6 19:06
 * @Version:1.0
 */
@RestController
@Api(value = "课程公开查询接口",tags = "课程公开查询接口")
@RequestMapping("open")
@Slf4j(topic = "课程公开查询接口")
public class CourseOpenController {

    @Autowired
    private CoursePublishService coursePublishService;

    @Autowired
    private CourseBaseInfoService courseBaseInfoService;

    @ApiOperation("公开预览文件信息")
    @GetMapping("/course/whole/{courseId}")
    public CoursePreviewDto getPreviewInfo(@PathVariable("courseId") Long courseId){

        //获取课程预览信息
        CoursePreviewDto coursePreviewInfo = coursePublishService.getCoursePreviewInfo(courseId);
        log.info("获取到课程预览的信息:{}",coursePreviewInfo);

        return coursePreviewInfo;

    }


}
